<?php
if (!defined('FosfoaSystem')) { exit(1);}
class currenciesModel extends spModel
{
	var $pk = "currencies_id"; // 每个唯一的标志，可以称为主键
	var $table = "currencies"; // 数据表的名称
    
    
    function jhDetail($currencies_id){
		$condition = array('currencies_id'=>$currencies_id);
		$arr = $this->find($condition);
		return $arr;
	}
    
    /**
     * 返回全部汇率集合
     */
     function Currencies_List()
     {
        $fields='currencies_id,title,code,value,symbol_left';
        return $this->spCache(3600 * 24)->findAll(null, null, $fields);
     }
    /**
     * 返回当前汇率
     * 返回指定汇率
     */
     function Get_currency($currencies_id=0)
     {
        $CurrenciesList=$this->Currencies_List();
        $arr['symbol_left'] = $CurrenciesList[$currencies_id]['symbol_left']; //当前汇率符号 $
        $arr['value'] = $CurrenciesList[$currencies_id]['value']; //当前汇率0.63
        $arr['code'] = $CurrenciesList[$currencies_id]['code']; //当前汇率符号 CNY
        return $arr;
     }
}